home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / serial / callback.001 / callback~ / callback / login / determinetty.c < prev    next >
C/C++ Source or Header  |  1996-07-22  |  568b  |  20 lines

  1.  
  2. #include "cblogin.h"
  3.  
  4. void determine_tty()
  5. {
  6.     char
  7.         *tty_name;
  8.                                         /* get the devicename */
  9.     if (!(tty_name = ttyname(fileno(stdin))))
  10.     error("Can't find the tty-name");
  11.  
  12.                     /* use the name without '/dev/' */
  13.     tty_name = strrchr(tty_name, '/') + 1;
  14.                                         /* activate it (or error) */
  15.     if (activate_ttyline(lookup_tty(tty_name)))
  16.         error("Line %s not available for callback", tty_name);
  17.         
  18.     assign_filenames(tty_name);         /* make proper tty-filenames */
  19. }
  20.